package Desen;

import java.awt.Color;

import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultHighlighter;

import GUI.SimulareDesenPanel;

public class HighlightDesen {
	
	public static void drawHighlight(String drawString ,int minus,Color col){
		int pos2 = SimulareDesenPanel.textdesen.getText().lastIndexOf(drawString);
		try {
			SimulareDesenPanel.textdesen.getHighlighter().addHighlight(pos2-minus, pos2 + drawString.length(),new DefaultHighlighter.DefaultHighlightPainter(col));
		} catch (BadLocationException e) {
			e.printStackTrace();
		}
		SimulareDesenPanel.textdesen.setCaretPosition(pos2);
	}

}
